<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>易买网 - 首页</title>
<link type="text/css" rel="stylesheet" href="css/style1.css" />
<script type="text/javascript" src="jsp/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="scripts/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
var b=false;
$(document).ready(function(){
	$('#userName').blur(function(){
		//alert("测试"+$(this).val());
		$.post("/easyBuy170601/regserlvet1",{userName:$(this).val()},
		function(data){
		if(data=="true"){
			$("#txtHint").html("账号已经被注册，请重新输入");
			b=false;
		}
	},"text")
	}) 
})
$(document).ready(function(){
	$('#userName').blur(function(){
		var userName=$(this).val();
		if(/^[a-zA-Z]\w{6,15}$/.test(userName)){
			$("#txtHint").html("<font color='green'>账号可以使用</font>");
			b=true;
		}else{
			$("#txtHint").html("账号由英文和数字组成");
			b=false;
		}
		if(userName.length==0&&userName==""){
			$("#txtHint").html("账号不能为空");
			b=false;
		}
		});
	$('#Name').blur(function(){
		var Name=$('#Name').val();
		if(/^[\u4E00-\u9FA5]{1,6}$/.test(Name)){
			$("#uName").html("<font color='green'>名字可以使用</font>");
			b=true;
		}else{
			$("#uName").html("名字由汉字组成");
			b=false;
		}
		if(Name.length==0&&Name==""){
			$("#uName").html("名字不能为空");
			b=false;
		}
	});
	$('#password').blur(function(){
		var password=$('#password').val();
		if(/^[a-z0-9_-]{5,18}$/.test(password)){
			$("#upassword").html("<font color='green'>密码可以使用</font>");
			b=true;
		}else{
			$("#upassword").html("<font color='red'>密码5~18位</font>");
			b=false;
		}
		if(password.length==0&&password==""){
			$("#upassword").html("<font color='red'>密码不能为空</font>");
			b=false;
		}
	});
	$('#confirmPassword').blur(function(){
		var password=$('#password').val();
		var confirmPassword=$('#confirmPassword').val();
		if(password==confirmPassword){
			$("#uconfirmPassword").html("<font color='green'>可以使用</font>");
			b=true;
		}else{
			$("#uconfirmPassword").html("<font color='red'>密码不一致</font>");
			b=false;
		}
	});
	
	$('birthday').blur(function(){
		var birthday=$('birthday').val();
		if(birthdy.length==0&&birthdy==null){
			$("#ubirthday").html("<font color='green'>不能为空</font>");
			b=false;
		}
		});
	$('#identityCode').blur(function(){
		var identityCode=$('#identityCode').val();
		if(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identityCode)){
			$("#uidentityCode").html("<font color='green'>可以使用</font>");
			b=true;
		}else{
			$("#uidentityCode").html("<font color='red'>按照中华民族规则输入</font>");
			b=false;
		}
		if(identityCode.length==0&&identityCode==""){
			$("#uidentityCode").html("<font color='red'>身份证不能为空</font>");
			b=false;
		}
	});
	$('#email').blur(function(){
		var email=$('#email').val();
		if(/^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(email)){
			$("#uemail").html("<font color='green'>可以使用</font>");
			b=true;
		}else{
			$("#uemail").html("<font color='red'>xxxx@163.com</font>");
			b=false;
		}
		if(email.length==0&&email==""){
			$("#uemail").html("<font color='red'>邮箱不能为空</font>");
			b=false;
		}
	})
	$('#mobile').blur(function(){
		var mobile=$('#mobile').val();
		if(/^((\d{3}-\d{8}|\d{4}-\d{7,8})|(1[3|5|7|8][0-9]{9}))$/.test(mobile)){
			$("#umobile").html("<font color='green'>可以使用</font>");
			b=true;
		}else{
			$("#umobile").html("<font color='red'>输入正确的手机号</font>");
			b=false;
		}
		if(mobile.length==0&&mobile==""){
			$("#umobile").html("<font color='red'>手机号不能为空</font>");
			b=false;
		}
	});
	
	$('#address').blur(function(){
		var address=$('#address').val();
		if(address.length==0&&address==null){
			$("#umobile").html("<font color='red'>地址不能为空</font>");
			b=false;
		}else{
			$("#umobile").html("<font color='green'>可以使用</font>");
			b=true;
		}
	})
	 //日历
    $("#birthday").click(function(){
        WdatePicker({
            highLineWeekDay:true //周末高亮
            ,readOnly:true      //只读，只可用控件input中 修改内容
            ,dateFmt:'yyyy-MM-dd'
        });
    });
	$('#submit').click(function(){
		if(b==true){
			$('from').submit();
		}else{
			return false;
		}
	});
	
})
</script>
</head>
<body>
<div id="header" class="wrap">
	<div id="logo"><img src="images/logo.gif" /></div>
	<div class="help"><a href="shopping.html" class="shopping">购物车X件</a><a href="login.html">登录</a><a href="register.html">注册</a><a href="guestbook.html">留言</a><a href="manage/index.html">后台管理</a></div>
	<div class="navbar">
		<ul class="clearfix">
			<li class="current"><a href="#">首页</a></li>
			<li><a href="#">图书</a></li>
			<li><a href="#">百货</a></li>
			<li><a href="#">品牌</a></li>
			<li><a href="#">促销</a></li>
		</ul>
	</div>
</div>
<div id="childNav">
	<div class="wrap">
		<ul class="clearfix">
			<li class="first"><a href="#">音乐</a></li>
			<li><a href="#">影视</a></li>
			<li><a href="#">少儿</a></li>
			<li><a href="#">动漫</a></li>
			<li><a href="#">小说</a></li>
			<li><a href="#">外语</a></li>
			<li><a href="#">数码相机</a></li>
			<li><a href="#">笔记本</a></li>
			<li><a href="#">羽绒服</a></li>
			<li><a href="#">秋冬靴</a></li>
			<li><a href="#">运动鞋</a></li>
			<li><a href="#">美容护肤</a></li>
			<li><a href="#">家纺用品</a></li>
			<li><a href="#">婴幼奶粉</a></li>
			<li><a href="#">饰品</a></li>
			<li class="last"><a href="#">Investor Relations</a></li>
		</ul>
	</div>
</div>
<div id="register" class="wrap">
	<div class="shadow">
		<em class="corner lb"></em>
		<em class="corner rt"></em>
		<div class="box">
			<h1>欢迎注册易买网</h1>
			<ul class="steps clearfix">
				<li class="current"><em></em>填写注册信息</li>
				<li class="last"><em></em>注册成功</li>
			</ul>
			<form id="regForm" method="post" action="insertSerlvet" >
				<table>
					<tr>
						<td class="field">用户名(*)：</td>
						<td>
							<input class="text" type="text" name="userName"  id="userName" maxlength="10" />
							<span id="txtHint"></span>
						</td>
					</tr>
					<tr>
						<td class="field">真实姓名(*)：</td>
						<td>
						<input type="text" name="name" id="Name"> 
						<!-- <input class="text" type="text" name="name" id="Name" /> --><span id="uName">
						</span></td>
					</tr>
					<tr>
						<td class="field">登录密码(*)：</td>
						<td><input class="text" type="password" id="password" name="password" /><span id="upassword"></span></td>
					</tr>
					<tr>
						<td class="field">确认密码(*)：</td>
						<td><input class="text" type="password" name="confirmPassword" id="confirmPassword" /><span id="uconfirmPassword"></span></td>
					</tr>
					<tr>
						<td class="field">性别(*)：</td>
						<td>
						  <input class="radio" type="radio" name="sex" value="0" checked="checked">
						  男性</input>
						  <input class="radio" type="radio" name="sex" value="1"						  
						  >女性</input>
						  <span></span></td>
					</tr>
					<tr>
						<td class="field">出生日期：</td>
						<td><input id="birthday" class="text" type="text" name="birthday" /><span></span></td>
					</tr>
					<tr>
						<td class="field">身份证：</td>
						<td><input class="text" type="text" name="identityCode" id="identityCode" /><span id="uidentityCode"></span></td>
					</tr>
					<tr>
						<td class="field">电子邮件：</td>
						<td><input class="text" type="text" name="email"  id="email"/><span id="uemail"></span></td>
					</tr>
					<tr>
						<td class="field">手机(*)：</td>						
						<td><input class="text" type="text" name="mobile" id="mobile" /><span id="umobile"></span></td>
					</tr>
					<tr>
						<td class="field">收货地址(*)：</td>
						<td><input class="text" type="text" name="address" id="address" /><span id="uaddress"></span></td>
					</tr>
					<tr>
						<td></td>
						<td><label class="ui-green"><input type="submit" name="submit" value="提交注册" id="submit" /></label></td>
					</tr>
				</table>
			</form>
		</div>
	</div>
	<div class="clear"></div>
</div>
<div id="footer">
	Copyright &copy; 2017 云和学院 All Rights Reserved. 京ICP证1000001号
</div>
</body>
</html>